/**
 * Interface defining the commands usable with all GameHandlers.
 * 
 * @author Paul Redert
 * 
 * author: Paul Redert
 * license: GPLV3
 * 
 * GoldenAK Bot - code.google.com/p/goldenak-bot
 * 
 */

package eu.goldenak.ircbot.game;

import java.util.Vector;

public interface Commands {
	
	/**
	 * Adds a listener to this GameHandler.
	 * @param listener the listener to be added
	 */
	public void addListener(Events listener);
	
	/**
	 * Removes listener from this GameHandler.
	 * @param listener the listener to be removed
	 */
	public void removeListener(Events listener);
	
	/**
	 * Adds a command listener to the queue of this GameHandler. 
	 * Only 1 commandhandler can receive commandevents at any given time.
	 * The first one in the queue will be able to receive command events.
	 * As soon as a module is done with receiving command events, it should un-queue itself, 
	 * so the other listeners on the queue can move one position up.
	 * @param listener the listener to be added to the queue
	 */
	public void queueCommandListener(CommandEvents listener);
	
	/**
	 * Removes a command listener from the queue 
	 * @param listener the listener to be removed from the queue
	 */
	public void unqueueCommandListener(CommandEvents listener);
	
	// TODO should probably be secured methods	
	/**
	 * Connects to the server provided in the config.
	 */
	public void connect();
	
	/**
	 * Disconnects from the currently connected server.
	 */
	public void disconnect();
	
	/** 
	 * Returns a player object for the player connected with the specified name.
	 * @param Name the name of the player to return
	 */
	public Player getPlayer(String Name);
	
	/**
	 * Returns a Vector with player objects for each connected player.
	 */
	public Vector<Player> getPlayers();

	/**
	 * Returns a Vector with all players on the specified team.
	 * @param Teamname the name of the team to return the players from
	 * @return 
	 */
	public Vector<Player> getTeam(String Teamname);
	
	/**
	 * Kicks a player from the server.
	 * @param p the player to be kicked
	 */
	public void kickPlayer(Player p);
		
	/**
	 * Kicks a player from the server.
	 * @param p the player to be kicked
	 * @param message message for the player being kicked
	 * @param duration the duration (in milliseconds) of the ban
	 */
	public void kickPlayer(Player p, String message, long duration);
	
	/**
	 * Bans player for predefined amount of time, with the possibility to send that player a message.
	 * @param p the player to be banned
	 * @param Message message for the player that's being banned
	 */
	public void banPlayer(Player p, String message);

	/**
	 * Send a message as console.
	 * @param Message the message to send 
	 */
	public void sendChat(String message);
	
	/**
	 * Send a message with the name specified.
	 * @param Name the name prefix before the message
	 * @param Message the message to send
	 */
	public void sendChat(String Name, String message);
	
	/**
	 * Send a message to the specified player. 
	 */
	public void sendPlayerChat(Player player, String message);
	
	/**
	 * Returns the currently active rotation.
	 */
	public Rotation getRotation();
	
	/**
	 * Sets the current rotation to the rotation specified.
	 */
	public void setRotation(Rotation rotation);
	
	/**
	 * Set the rotation to load during startup of the game.
	 * @param rotation
	 */
	public void setDefaultRotation(Rotation rotation);
}